#define _CRT_SECURE_NO_WARNINGS 1
#/*include <iostream>
#include <string>
#include <map>
using namespace std;
int mian()
{
    int n = 0, l = 0, r = 0;
    cin >> n >> l >> r;
    string s;
    cin >> s;
    int left = 0, right = 0;
    map<char, int> m;
    m[s[0]]++;
    int count = 0;
    while (right < n)
    {
        if (m.size() >= l && m.size() <= r)
        {
            count += left - right + 1;
            ++right;
            m[s[right]]++;
        }
        else
        {
            m[s[left]]--;
            if (m[s[left]] == 0) m.erase(s[left]);
            ++left;
        }
    }
    cout << count << endl;
    return 0;
}*/
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
    int n = 0, l = 0, r = 0;
    cin >> n >> l >> r;
    string s;
    cin >> s;
    map<char, int> m;
    m[s[0]]++;
    int left = 0, right = 0;
    long long count1 = 0;
    cerr << "!" << endl;
    while (right < n && left <= right)
    {
        if (m.size() >= 1 && m.size() <= r)
        {
            count1 += right - left + 1;
            right++;
            m[s[right]]++;
        }
        else
        {
            m[s[left]]--;
            if (m[s[left]] == 0) m.erase(s[left]);
            left++;
        }
    }
    m.clear();
    m[s[0]]++;
    left = right = 0;
    long long count2 = 0;
    cerr << "#" << m.size() << endl;
    while (right < n && left <= right)
    {
        if (m.size() >= 1 && m.size() <= l - 1)
        {
            count2 += right - left + 1;
            right++;
            m[s[right]]++;
        }
        else
        {
            m[s[left]]--;
            if (m[s[left]] == 0) m.erase(s[left]);
            left++;
        }
        //cerr<<left<<" "<<right<<" "<<m.size()<<endl;
    }
    cout << count1 - count2 << endl;
    return 0;
}